package com.gopay.common.gateway.manager.impl;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.gopay.common.domain.pg.PgGenOrderTransDtl;
import com.gopay.common.exception.GopayException;
import com.gopay.common.gateway.dao.PgGeneralOrderTransDtlQueryDAO;
import com.gopay.common.gateway.manager.PgGeneralOrderTransDtlQueryManager;
import com.gopay.common.security.encryptiondecryption.DesUtilWithStockOfData;

/**
 * 网关通用订单交易Manager
 * 
 * @PgGeneralOrderTransDtlQueryManagerImpl.java
 * @author GongZhong
 * @2013-1-6 下午04:09:05 www.gopay.com.cn Inc.All rights reserved.
 */
@Service("pgGeneralOrderTransDtlQueryManager")
public class PgGeneralOrderTransDtlQueryManagerImpl implements PgGeneralOrderTransDtlQueryManager {

    @Resource(name = "pgGeneralOrderTransDtlQueryDAO")
    private PgGeneralOrderTransDtlQueryDAO pgGeneralOrderTransDtlQueryDAO;

    @Override
    public PgGenOrderTransDtl get(Serializable id) {
        PgGenOrderTransDtl dtl =  this.pgGeneralOrderTransDtlQueryDAO.find(PgGenOrderTransDtl.class, id);
        
        //目前chshier 和cps的checker中都使用该manage进行流水查询 因此统一在这里 解密 并处理存量数据
        DesUtilWithStockOfData.decrypt(dtl, true);
        
        return dtl;
    }

    @Override
    public List<PgGenOrderTransDtl> get(Map<Object, Object> paraMap) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public List<PgGenOrderTransDtl> getAll() {
        return this.pgGeneralOrderTransDtlQueryDAO.findAll(PgGenOrderTransDtl.class);
    }

    @Override
    public void update(PgGenOrderTransDtl PgGenOrderTransDtl) throws GopayException {
        pgGeneralOrderTransDtlQueryDAO.update(PgGenOrderTransDtl);
    }
    
}
